<!-- 虚拟消息框 -->
 <div class="fq-information am-round am-padding-right-sm information dummy_message" style="display: none;" data-start="1">
    <img src="" class="am-round dummy-img">
    <div class="am-inline-block am-fr">
        <div class="am-text-sm dummy-name">爱淘客</div>
        <span class="am-inline-block am-text-sm">成功领取一张<span class="dummy-coupons">0</span>元优惠券</span>
    </div>
</div> 
<script>
        $('.dummy_message').click(function(){
             $('.dummy_message').hide();
        });   
        var dummy_counts="{$dummy_times}"*1000;
        var dummy_times="3"*1000;
       function dummy(time,status){
          $.ajax({
            url:"{:U('Index/getdummy')}",
            dataType:"json",
            success:function(data){

                var data_info = data.data.one_user_info;
                if(status == 1){
                    $('.dummy_message').css('display','block');
                }else{
                    $('.dummy_message').css('display','none');
                    if(data_info){
                        $('.dummy-img').attr('src',data_info.wxheadpic);
                     }else{
                        $('.dummy-img').attr('src','');
                     }   
                    if(data_info){
                            var nickname = data_info.wxnickname;
                            var namelength = nickname.length;
                            if(namelength>2){
                                var reg =  /^(.).+(.)$/g;
                                var name = nickname.replace(reg, "$1*$2");
                            }else{
                                var name = nickname.replace(/.(?=.)/g,'*');
                            }
                            $('.dummy-name').html(name);
                         }else{
                            $('.dummy-name').html('**');
                    }   
                    $('.dummy-coupons').html(data.data.random_coupons);
                }
                var t = setInterval(function(){
                    if(status == 1){
                        dummy(dummy_counts,0);
                    }else{
                        dummy(dummy_times,1);
                    }
                    clearInterval(t);
                },time); 
            }
         });
        }
        setTimeout("dummy(dummy_counts,0)",0);     
</script>